import { createRouter, createWebHashHistory } from 'vue-router'
import Home from '../views/Home.vue'

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/about',
    name: 'About',
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  },
  {
    path: '/watch',
    name: 'Watch',
    component: () => import(/* webpackChunkName: "about" */ '../views/watch.vue')
  },
  {
    path: '/commont',
    name: 'Commont',
    component: () => import(/* webpackChunkName: "about" */ '../views/commont.vue')
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})
// router.beforeEach((to,from)=>{
//   // to 是要去的页面 from 来自哪里
//   console.log(to); 
//   console.log(from);
//   if (to.path == '/about'){
//     alert('您没有资格')
//     return false
//   }
 
// })

export default router
